﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Miao.DataFormat
{
    public class MiaoListData : MiaoParserData, IEnumerable<MiaoParserData>, IEnumerable
    {
        private readonly List<MiaoParserData> dataList = new List<MiaoParserData>();

        public override DataType type => DataType.List;

        public MiaoParserData this[int index] => dataList[index];

        public void AddElement(MiaoParserData element)
        {
            dataList.Add(element);
        }

        public void RemoveElement(MiaoParserData element)
        {
            dataList.Remove(element);
        }

        public IEnumerator<MiaoParserData> GetEnumerator()
        {
            return dataList.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return dataList.GetEnumerator();
        }
    }
}
